import { v3, Vec3 } from "cc";

const tempVec = v3()
export class MathUtil {
    /**
     * 求两个向量间的夹角（带符号）
     * @param from 
     * @param to 
     * @param axis 
     * @returns 
     */
    static signAngle(from: Vec3, to: Vec3, axis: Vec3): number {
        const angle = Vec3.angle(from, to)
        Vec3.cross(tempVec, from, to)
        const dot = Vec3.dot(tempVec, axis)
        
        return angle * Math.sign(dot)
    }
}